#installing on /usr/local prevents showing desktop file on gnome menu
#in mint 12 desktop file is detected right away
PREFIX=/usr

all: relayduino-cli relayduino-gtk

relayduino-cli: relayduino-cli.vala relayduino-common.vala
	valac relayduino-cli.vala relayduino-common.vala -o relayduino-cli --pkg posix --pkg linux --pkg glib-2.0

relayduino-gtk: relayduino-gtk.vala relayduino-common.vala
	valac relayduino-gtk.vala relayduino-common.vala -o relayduino-gtk --pkg posix --pkg linux --pkg gtk+-2.0 --pkg gmodule-2.0

install: all
	mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps
	mkdir -p $(DESTDIR)$(PREFIX)/share/applications
	install relayduino-cli $(DESTDIR)$(PREFIX)/bin
	install relayduino-gtk $(DESTDIR)$(PREFIX)/bin
	install relayduino.desktop $(DESTDIR)$(PREFIX)/share/applications
	install -m 644 relayduino.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps
	find $(DESTDIR)$(PREFIX) -name "relayduino*"
	gtk-update-icon-cache -f -q $(DESTDIR)$(PREFIX)/share/icons/hicolor

uninstall:
	rm -f $(DESTDIR)$(PREFIX)/bin/relayduino-cli
	rm -f $(DESTDIR)$(PREFIX)/bin/relayduino-gtk
	rm -f $(DESTDIR)$(PREFIX)/share/applications/relayduino.desktop
	rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/relayduino.png
	find $(DESTDIR)$(PREFIX) -name "relayduino*"
	gtk-update-icon-cache -f -q $(DESTDIR)$(PREFIX)/share/icons/hicolor

clean:
	rm -f relayduino-cli relayduino-gtk

